import {
  MODAL_STATE,
  LOSS_MODAL_STATE,
  CONFIRM_MODAL_STATE,
  DELETE_MODAL_STATE,
  APPOINT_DRAWER_STATE,
  APPOINT_CONFIRM_STATE,
  CUSTOMER_DRAWER_STATE,
  PASSWORD_MODAL_STATE,
  SALE_DRAWER_STATE,
  CUSTOMER_CONFIRM_STATE,
  REFUND_MODAL_STATE,
  TEAM_DRAWER_STATE,
  ADD_GROUP_DRAWER_STATE,
  ADD_GROUP_CONFIRM_STATE
} from '../motations-type'

export default {
  state: {
    modalState: false,
    confirmModalState: false,
    lossModalState: false,
    deleteModalState: false,
    customerDrawerState: false,
    appointDrawerState: false,
    passwordModalState: false,
    customerConfirmState: false,
    saleDrawerState: false,
    refundModalState: false,
    teamDrawerState: false,
    addGroupDrawerState: false,
    addGroupConfirmState: false,
    appointConfirmState: false
  },
  getters: {
    modalState: state => state.modalState
  },
  mutations: {
    [MODAL_STATE] (state, data) {
      state.modalState = data
    },
    [CONFIRM_MODAL_STATE] (state, data) {
      state.confirmModalState = data
    },
    [LOSS_MODAL_STATE] (state, data) {
      state.lossModalState = data
    },
    [DELETE_MODAL_STATE] (state, data) {
      state.deleteModalState = data
    },
    [CUSTOMER_DRAWER_STATE] (state, data) {
      state.customerDrawerState = data
    },
    [APPOINT_DRAWER_STATE] (state, data) {
      state.appointDrawerState = data
    },
    [APPOINT_CONFIRM_STATE] (state, data) {
      state.appointConfirmState = data
    },
    [PASSWORD_MODAL_STATE] (state, data) {
      state.passwordModalState = data
    },
    [CUSTOMER_CONFIRM_STATE] (state, data) {
      state.customerConfirmState = data
    },
    [SALE_DRAWER_STATE] (state, data) {
      state.saleDrawerState = data
    },
    [REFUND_MODAL_STATE] (state, data) {
      state.refundModalState = data
    },
    [TEAM_DRAWER_STATE] (state, data) {
      state.teamDrawerState = data
    },
    [ADD_GROUP_DRAWER_STATE] (state, data) {
      state.addGroupDrawerState = data
    },
    [ADD_GROUP_CONFIRM_STATE] (state, data) {
      state.addGroupConfirmState = data
    }
  },
  actions: {
    async updateModalState ({ commit, rootState }, playload) {
      commit(MODAL_STATE, playload)
    },
    async updateConfirmModalState ({ commit, rootState }, playload) {
      commit(CONFIRM_MODAL_STATE, playload)
    },
    async updateLossModalState ({ commit, rootState }, playload) {
      commit(LOSS_MODAL_STATE, playload)
    },
    async updateDeleteModalState ({ commit, rootState }, playload) {
      commit(DELETE_MODAL_STATE, playload)
    },
    async updateCustomerDrawerState ({ commit, rootState }, playload) {
      commit(CUSTOMER_DRAWER_STATE, playload)
    },
    async updateAppointDrawerState ({ commit, rootState }, playload) {
      commit(APPOINT_DRAWER_STATE, playload)
    },
    async updateAppointConfirmState ({ commit, rootState }, playload) {
      commit(APPOINT_CONFIRM_STATE, playload)
    },
    async updateSaleDrawerState ({ commit, rootState }, playload) {
      commit(SALE_DRAWER_STATE, playload)
    },
    async updateCustomerConfirmState ({ commit, rootState }, playload) {
      commit(CUSTOMER_CONFIRM_STATE, playload)
    },
    async updateRefundModalState ({ commit, rootState }, playload) {
      commit(REFUND_MODAL_STATE, playload)
    },
    async updateTeamDrawerState ({ commit, rootState }, playload) {
      commit(TEAM_DRAWER_STATE, playload)
    },
    async updateAddGroupDrawerState ({ commit, rootState }, playload) {
      commit(ADD_GROUP_DRAWER_STATE, playload)
    },
    async updateAddGroupConfirmState ({ commit, rootState }, playload) {
      commit(ADD_GROUP_CONFIRM_STATE, playload)
    },
    async updatePasswordModalState ({ commit, rootState }, playload) {
      commit(PASSWORD_MODAL_STATE, playload)
    }
  }
}
